This is the replication file for Evans & King (2020) 'Statistically Valid Inferences from Differentially Private Data Releases, with Application to the
Facebook URLs Dataset' 

- To replicate the results in the paper, execute the script `RUN_ALL.R`. This script will install (if necessary) and load the required packages. It then calls several R scripts which we describe below. Note that we also rely heavily on our package `PrivacyUnbiased` which implements all methods in the paper, code & documentation for which can be found at https://github.com/georgieevans/PrivacyUnbiased. 

- `RUN_ALL.R` takes an hour to run on an M1 Mac OS laptop with 8gb of RAM and 4 cores

- The following packages will be installed (if not already) and loaded: 
 
	"tidyverse", "ggpubr", "latex2exp", "rlist", "xtable", "gridExtra", "mpoly", "moments"

- Below we describe the scripts that `RUN_ALL.R` calls in more detail:

1. `simulation_functions.R` contains a set of functions to run simulationss to produce the results in Fig 1 & 2
2. `main_simulation_run.R` runs the simulations for Fig 1 & 2 
3. `variance_time.R` tests time to estimate the variance, and stores the results for Fig 2b 
4. `main_figures.R` generates the figures in Fig 1 & 2 based on output from steps 2&3, and saves them to subfolder `plots` 
5. `application.R` replicates Fig 3. The neccessary data is located in the `\data` folder. The data was downloaded from https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/27718 
6. `distributions.R` generates Table 2 and Fig 4
7. `diagnostics.R` generates Fig 5 & Table 3

Note: Unfortunately for privacy reasons we are unable to share data used to generate the results on the FB URls results reported in Table 1, the code is found in the `FB_code` subfolder. Learn how to apply for access to the data at https://socialscience.one/.